      SUBROUTINE FULLINTEGRAL1(IFINAL, IAAAA, IBBBB, IABAB, IBABA,
     &               IAABB, IBBAA, NI1A, NI1B, NI2A, NI2B, NI3A,
     &               NI3B, NI4A, NI4B, NI1, NI2, NI3, NI4, IOP)
C
      IMPLICIT NONE
C
      INTEGER, intent(in) :: NI1A, NI1B, NI2A, NI2B, NI3A, NI3B
      INTEGER, intent(in) :: NI4A, NI4B, NI1, NI2, NI3, NI4, IOP
      DOUBLE PRECISION, intent(in) :: IAAAA(NI1A, NI2A, NI3A, NI4A)
      DOUBLE PRECISION, intent(in) :: IBBBB(NI1B, NI2B, NI3B, NI4B)
      DOUBLE PRECISION, intent(in) :: IABAB(NI1A, NI2B, NI3A, NI4B)
      DOUBLE PRECISION, intent(in) :: IBABA(NI1B, NI2A, NI3B, NI4A)
      DOUBLE PRECISION, intent(in) :: IAABB(NI1A, NI2A, NI3B, NI4B)
      DOUBLE PRECISION, intent(in) :: IBBAA(NI1B, NI2B, NI3A, NI4A)
C
      DOUBLE PRECISION, intent(out) :: IFINAL(NI1,NI2,NI3,NI4)
C
      INTEGER :: I, J, K, L, I1, J1, K1, L1
C
C==== FOR WMBEJ and sort as EM,BJ 
C
      IFINAL = 0.D0
C----AAAA
      DO I = 1, NI1A
         DO J = 1, NI2A
            DO K = 1, NI3A
               DO L = 1, NI4A
                  IFINAL(I,J,K,L) = -IAAAA(I,J,K,L)
               ENDDO
            ENDDO
         ENDDO
      ENDDO
C----ABAB
      DO I = 1, NI1A
         DO J = NI2A+1, NI2
            DO K = 1, NI3A
               DO L = NI4A+1, NI4
                  J1 = J - NI2A
                  L1 = L - NI4A
                  IFINAL(I,J,K,L) = -IABAB(I,J1,K,L1)
               ENDDO
            ENDDO
         ENDDO
      ENDDO
C----AABB
      DO I = 1, NI1A
         DO J = 1, NI2A
            DO K = NI3A+1, NI3
               DO L = NI4A+1, NI4
                  L1 = L - NI4A
                  K1 = K - NI3A
                  IFINAL(I,J,K,L) = IAABB(I,J,K1,L1)
               ENDDO
            ENDDO
         ENDDO
      ENDDO
C----BABA
      DO I = NI1A+1, NI1
         DO J = 1, NI2A
            DO K = NI3A+1, NI3
               DO L = 1, NI4A
                  I1 = I - NI1A
                  K1 = K - NI3A
                     IFINAL(I,J,K,L) = -IBABA(I1,J,K1,L)
               ENDDO
            ENDDO
         ENDDO
      ENDDO
C----BBAA
      DO I = NI1A+1, NI1
         DO J = NI2A+1, NI2
            DO K = 1, NI3A
               DO L = 1, NI4A
                  I1 = I - NI1A
                  J1 = J - NI2A
                     IFINAL(I,J,K,L) = IAABB(K,L,I1,J1)
               ENDDO
            ENDDO
         ENDDO
      ENDDO
C----BBBB
      DO I = NI1A+1, NI1
         DO J = NI2A+1, NI2
            DO K = NI3A+1, NI3
               DO L = NI4A+1, NI4
                  I1 = I - NI1A
                  J1 = J - NI2A
                  K1 = K - NI3A
                  L1 = L - NI4A
                  IFINAL(I,J,K,L) = -IBBBB(I1,J1,K1,L1)
               ENDDO
            ENDDO
         ENDDO
      ENDDO
C
      RETURN
      END
